<?php
function __autoload($class)
{
    require_once($class . '.php');
}

$context = new InterpreterContext();
$myvar = new VariableExpression('input', 'four');
$myvar->interpret($context);
print $context->lookup($myvar) . "\n";

$newvar = new VariableExpression('input');
$newvar->interpret($context);
print $context->lookup($newvar) . "\n";

$myvar->setValue("five");
$myvar->interpret($context);
print $context->lookup($myvar) . "\n";

print $context->lookup($newvar) . "\n";

$context = new InterpreterContext();
$input = new VariableExpression('input');
$statement = new BooleanOrExpression(
    new EqualsExpression($input, new LiteralExpression('four')),
    new EqualsExpression($input, new LiteralExpression(4))
);

foreach (array('four', 4, 52) as $val ) {
    $input->setValue($val);
    print "$val: \n";
    $statement->interpret($context);
    if ($context->lookup($statement)) {
        print "top marks\n\n";
    } else {
        print "dunce hat on\n\n";
    }
}

?>